/**
 * Created with IntelliJ IDEA.
 * Description:
 */
import java.util.Scanner;

public class TestDemo {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] arr = new int[];
        for(int i = 0;i < n;i++){
            arr[i] = scanner.nextInt(i);
        }
        int delet = scanner.nextInt();
        for(int j = 0; j < arr.length-1;j++){
            if(arr[j] == delet){
                arr[j] = arr[j+1];
            }
        }
        for (int k = 0; k < arr.length-1; k++) {
            arr[k] = scanner.nextInt(i);

        }
    }
}
